<template>
	<view>
		<view v-for="(item,index) in nameList" :key="index" @click="djxm(item)">
			{{item.name}}
		</view>
		<button @click="qd">确定</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				nameList:[];
			};
		},
		methods:{
			getList(){
				uni.request({
					url:"http://localhost:3000/name"
				}).then((resp)=>{
					this.nameList=resp[1].data
				})
			},
			djxm(item){
				uni.setStorageSync('name',item.name)
			},
			qd(){
				uni.switchTab({
					url:"/pages/JKD/JKD"
				})
			},
		},
		created() {
			this.getList()
		}
	}
</script>

<style lang="scss">

</style>
